<?
   $doc = new DOMDocument("1.0","UTF-8");
   $html = $doc->createElement("html");
   $body = $doc->createElement("body");
   $h1 = $doc->createElement("h1","Styl OOP w PHP");
   $h1->setAttribute("id","firsth1");
   $p = $doc->createElement("p");
   $p->appendChild($doc->createTextNode("Witaj - a co z tekstem?"));
   $body->appendChild($h1);
   $body->appendChild($p);
   $html->appendChild($body);
   $doc->appendChild($html);
   echo $doc->saveHTML();
?>
